package com.gzhryc.pay.adaptation.alipay.enums;

import com.gzhryc.common.config.I18nTools;
import com.gzhryc.pay.enums.ReceivingMoneyType;

public enum AliTransferMoneyType {

	/**B2C 单笔无密转账到支付宝账户**/
	ToAccount(ReceivingMoneyType.Account.index(),"TRANS_ACCOUNT_NO_PWD","DIRECT_TRANSFER"),
	/**B2C 单笔无密转账到银行卡**/
	ToBankcard(ReceivingMoneyType.Bank.index(),"TRANS_BANKCARD_NO_PWD","DIRECT_TRANSFER");
	
	private Integer index;
	private String productCode;
	private String bizScene;
	
	AliTransferMoneyType(Integer index,String productCode,String bizScene){
		this.index = index;
		this.productCode = productCode;
		this.bizScene = bizScene;
	}

	public Integer index() {
		return index;
	}

	public String productCode() {
		I18nTools.I18n i18n = I18nTools.getCurrentI18n();
		if(i18n != null) {
			return i18n.get(this.name(),productCode);
		}
		return productCode;
	}
	
	public String bizScene() {
		I18nTools.I18n i18n = I18nTools.getCurrentI18n();
		if(i18n != null) {
			return i18n.get(this.name(),bizScene);
		}
		return bizScene;
	}
	
	public static AliTransferMoneyType type(Integer index){
		AliTransferMoneyType[] temp = AliTransferMoneyType.values();
		for(int i=0;i<temp.length;i++){
			AliTransferMoneyType item = temp[i];
			if(item.index.equals(index)){
				return item;
			}
		}
		return null;
	}
}
